//
//  UIButton+Factory.m
//  即时通讯
//
//  Created by huangtao on 16/7/9.
//  Copyright © 2016年 fish. All rights reserved.
//

#import "UIButton+Factory.h"
#import <LeanChatLib/UIImage+Icon.h>
@implementation UIButton (Factory)
+(UIButton *)buttonWithFrame:(CGRect)frame
                 normalTitle:(NSString *)normalTitle
                      target:(id)target
                      action:(SEL)selector
{
    UIButton *button = [[self alloc]initWithFrame:frame];
    
        [button setBackgroundImage:[UIImage resizableImageNamed:@"blue_expand_normal"] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage resizableImageNamed:@"blue_expand_highlight"] forState:UIControlStateHighlighted];
    [button setBackgroundImage:[UIImage resizableImageNamed:@"blue_expand_highlight"] forState:UIControlStateDisabled];
    [button setTitle:normalTitle forState:UIControlStateNormal];
    [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    return button;
}

+ (UIButton *)bottomButtonWithFrame:(CGRect)frame
                        normalTitle:(NSString *)normalTitle
                             target:(id)target
                             action:(SEL)selector
{
    UIButton *button = [[self alloc]initWithFrame:frame];
    UIImage *image = [[UIImage imageNamed:@"bottom_bar_normal"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
    UIImage *selectedImage = [[UIImage imageNamed:@"bottom_bar_selected"] resizableImageWithCapInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
    [button setBackgroundImage:image forState:UIControlStateNormal];
    [button setBackgroundImage:selectedImage forState:UIControlStateHighlighted];
    [button setTitleColor:RGBCOLOR(93, 92, 92) forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:15];
    [button setTitleShadowColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button setTitle:normalTitle forState:UIControlStateNormal];
    [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    return button;
    
}
@end
